<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="org.store.pojo.*" %>
<%@ page import="org.user.pojo.*" %>
<%@ page import="org.store.tools.*"  %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
    String url = request.getRequestURI();
    if(request.getQueryString()!=null)
        url+= "?" + request.getQueryString();
    session.setAttribute("url",url); 
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Help.u</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/rsp/content/wwy/css/style.css" type="text/css" media="all" />
<!--[if lte IE 6]><link rel="stylesheet" href="css/ie6.css" type="text/css" media="all" /><![endif]-->
<script src="/rsp/content/wwy/js/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="/rsp/content/wwy/js/jquery.jcarousel.pack.js" type="text/javascript"></script>
<script src="/rsp/content/wwy/js/jquery-func.js" type="text/javascript"></script>
</head>
<body>
<%
          List sps = (List)session.getAttribute("shops");
          List gds = (List) session.getAttribute("goods");
          List goodslist = (List) session.getAttribute("goodslist");
          PageList pl = (PageList) session.getAttribute("gdpl");
%>
<!-- Shell -->
<div class="shell">
  <!-- Header -->
  <div id="header">
    <h1 id="logo"><a href = "">help.u</a></h1>
    <!-- Cart -->
    <div id="cart"> 
    <%
    	User user = (User)session.getAttribute("user");
    	ArrayList gs = (ArrayList) session.getAttribute("car");
    	int sum = 0;
    	if(gs !=null )for(int i =0 ;i< gs.size();i++) {
    		Goods gd = (Goods)gs.get(i); 
    		sum+=gd.getPrice();
    	}
    	if(user != null){
    	
     %>
     <a href="/rsp/content/user/center.jsp" class="cart-link"><%=user.getName() %> </a>
     
      <div class="cl">&nbsp;</div>
      <span><a href="/rsp/goods/buy?flag=5" style="color: white;">购物车:</a><strong><%=gs==null?0:gs.size() %></strong></span> &nbsp;&nbsp; <span>总值: <strong><%=sum %></strong>
      <a href = "/rsp/goods/login?flag=1" style="color:white;">登出</a>
      <%if(user.getName().compareTo("管理员") == 0) { %><a href = "/rsp/content/wwy/adminPage/index.jsp" style="color:white;">管理</a><%} %>></span>
      <%}else{ %>
      <a href="/rsp/content/wwy/login.jsp" class="cart-link">请登录</a><a href="/rsp/content/wwy/register.jsp" class="cart-link">注册</a>
      <%} %>
       
    </div>
    <!-- End Cart -->
    <!-- Navigation -->
    <div id="navigation">
      <ul>
        <li><a href="/rsp/content/wwy/tmp.jsp" >主页</a></li>
        <li><a href="/rsp/goods/show?flag=3">随便看看</a></li>
        <li><a href="/rsp/goods/show?flag=4">查看优惠</a></li>
        <li><a href="/rsp/content/wwy/usrPage/usrMsg.jsp">个人信息</a></li>
        <li><a href="#">关于我们</a></li>
      </ul>
    </div>
    <!-- End Navigation -->
  </div>
  <!-- End Header -->
  <!-- Main -->
  <div id="main">
    <div class="cl">&nbsp;</div>
    <!-- Content -->
    <div id="content">
      <!-- Content Slider -->
      
      <!-- End Content Slider -->
      <!-- Products -->
      <div class="products">
        <div class="cl">&nbsp;</div>
        <ul>
        <%
        for(int i = 0 ; i< goodslist.size()&&i<6 ; i++){
        Goods gd = (Goods)goodslist.get(i);
        if(i%3 != 2){
         %>
          <li> <a href="/rsp/goods/show?flag=0&goodId=<%=gd.getId() %>">
          <img src="/rsp/content/wwy/css/goods/<%=gd.getGraph() %>.jpg" alt="" width="233px" height="381"/></a></a>
            <div class="product-info">
              <h3><%=gd.getName() %></h3>
              <div class="product-desc">
                <% int t = Integer.parseInt(gd.getType()); %>
                <h4>类别 ： <%=China.toGoodsType(t) %></h4>
                
                <p>数量:<%=gd.getNum() %></p>
                <strong class="price">￥<%=gd.getPrice() %></strong> </div>
            </div>
          </li>
          <%}else{  %>
          <li class="last"> <a href="/rsp/goods/show?flag=0&goodId=<%=gd.getId() %>">
          <img src="/rsp/content/wwy/css/goods/<%=gd.getGraph() %>.jpg" alt="" width="233px" height="361"/></a></a>
            <div class="product-info">
              <h3><%=gd.getName() %></h3>
              <div class="product-desc">
              <% int t = Integer.parseInt(gd.getType()); %>
                <h4>类别 ： <%=China.toGoodsType(t) %></h4>
                
                <p>数量:<%=gd.getNum() %></p>
                <strong class="price">￥<%=gd.getPrice() %></strong> </div>
            </div>
          </li>
          <%}} %>
        
          
        </ul>
        
        
        <div class="cl">&nbsp;</div>
        <div class = "pagelist"><h2>
	    <div id="pageList">
		<div align="center">
		<ul style="list-style-type: none;">
		<span class="STYLE1"><a href="/rsp/goods/show?flag=5&bg=1">首页</a>
		<%
			for (int i = 1; i <= pl.getMaxPage(); i++) {
			if (pl.getCurrentPage() == i) {
		%><%=i%> <%
	 	} else {
	 %> <a href="/rsp/goods/show?flag=5&&bg=<%=i%>"><%=i%></a> <%
	 	}
	 	}
	 %> <a href="/rsp/goods/show?flag=5&&bg=<%=pl.getMaxPage()%>">尾页</a> </span>
		
		</ul>
		</div>
		</div>
		</h2></div>
		
      </div>
      <!-- End Products -->
    </div>
    <!-- End Content -->
    <!-- Sidebar -->
      <div id="sidebar">
      <!-- Search -->
      <div class="box search">
        <h2>搜索商品 <span></span></h2>
        <div class="box-content">
          <form action="/rsp/goods/show?flag=2" method="post">
            <label>关键字</label>
            <input type="text" class="field" name = "keyword"/>
            <label>分类</label>
            <select class="field" name="type">
              <option value="0">书籍类</option>
         		<option value="1">生活用品</option>
         		<option value="2">学习用品</option>
         		<option value="4">玩具类</option>
         		<option value="5">餐饮类</option>
            </select>
            <div class="inline-field">
              <label>价格</label>
              <select class="field small-field" name="low">
                <option value="10">10</option>
                <option value="20">20</option>
              </select>
              <label>to:</label>
              <select class="field small-field" name="high">
                <option value="30">30</option>
                <option value="150">150</option>
              </select>
            </div>
            <input type="submit" class="search-submit" value="Search" />
          </form>
        </div>
      </div>
      <!-- End Search -->
      <!-- Categories -->
      <div class="box categories">
        <h2>商店分类 <span></span></h2>
        <div class="box-content">
          <ul>
          
          <%
          for(int i=0;i<sps.size() -1;i++){
          Shop sp = (Shop)sps.get(i);
           %>
            <li><a href="/rsp/goods/show?flag=1&shopId=<%=sp.getId() %>"><%=sp.getName() %></a></li>
            <%} %>
            <%Shop sp = (Shop)sps.get(sps.size()-1);  %>
            <li class="last"><a href="/rsp/goods/show?flag=1&shopId=<%=sp.getId() %>"><%=sp.getName() %></a></li>
          </ul>
        </div>
      </div>
      <!-- End Categories -->
    </div>
    <!-- End Sidebar -->
    <div class="cl">&nbsp;</div>
  </div>
  <!-- End Main -->
  <!-- Side Full -->
  <div class="side-full">
    <!-- More Products -->
    <div class="more-products">
      <div class="more-products-holder">
        <ul>
        <%
        for(int i = 0 ; i< gds.size() ; i++){
        Goods gd = (Goods)gds.get(i);
         %>
          <li><a href="/rsp/goods/show?flag=0&goodId=<%=gd.getId() %>"><img src="/rsp/content/wwy/css/goods/<%=gd.getGraph() %>.jpg" alt="" width="96px" height="96px"/></a></li>
          <%} %>
          
          
        </ul>
      </div>
      <div class="more-nav"> <a href="#" class="prev">previous</a> <a href="#" class="next">next</a> </div>
    </div>
    <!-- End More Products -->
    <!-- Text Cols -->
    <div class="cols">
      <div class="cl">&nbsp;</div>
      <div class="col">
        <h3 class="ico ico1">Help.u的地址</h3>
        <p>福建省福州市闽侯县上街镇大学城生活1区Src工作室.</p>
      </div>
      <div class="col">
        <h3 class="ico ico2">联系电话</h3>
        <p>电话：12456789<br />QQ :123321<br />E-mail : 123654@qq.com</p>
      </div>
      <div class="col">
        <h3 class="ico ico3">提供服务</h3>
        <p>提供大学城周边一些图书信息的查询，为方便学生
        而设计的服务项目，同时包含了周边最新的优惠信息，为了同学们出行的指南.</p>
      </div>
      <div class="col col-last">
        <h3 class="ico ico4">商家入驻</h3>
        <p>欢迎各种商家联系我们，我们为您提供优质的服务.<br />
        包括：添加您的商店，提供更新您商品信息，以及展示您商品宣传广告</p>
      </div>
      <div class="cl">&nbsp;</div>
    </div>
    <!-- End Text Cols -->
  </div>
  <!-- End Side Full -->
  <!-- Footer -->
  <div id="footer">
    <p class="left">  </p>
    <p class="right"> &copy; 2012 Srp. Design by <a href="#">src项目小组</a> </p>
  </div>
  <!-- End Footer -->
</div>
<!-- End Shell -->
</body>
</html>